package com.collabscm.waf.domain.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import com.collabscm.waf.util.JsonUtils;
import com.collabscm.waf.util.ObjectUtils;
import com.collabscm.waf.vo.IValueObject;

/**
 * 所有Domain对象的基类，为了防止属性名写错，或者将来属性名可能变更那么给每个可能用于索引的属性都
 * 添加上对应的属性的一个常量，例如：creator其对应属性名是AttrCreator(就是存放“creator”)。
 * 注意：是所有需要作为查询或过滤条件等才需要建立常量。
 * 
 * @author Zeng Raoxing
 */
@MappedSuperclass public abstract class DomainObject implements IValueObject {
	private static final long serialVersionUID = 1L;
	/**
	 * 创建人
	 */
	@Column (name="Creator", nullable = false)
	protected Long creator;
	public static final String AttrCreator = "creator";
	/**
	 * 创建时间
	 */
	@Column (name="Created_Time", nullable = false)
	protected Date createdTime;
	public static final String AttrCreatedTime = "createdTime";
	/**
	 * 最后修改人
	 */
	@Column (name="Last_Updator", nullable = false)
	protected Long lastUpdator;
	public static final String AttrLastUpdator = "lastUpdator";
	/**
	 * 最后修改时间
	 */
	@Column (name="Last_Updated_Time", nullable = false)
	protected Date lastUpdatedTime;
	public static final String AttrLastUpdatedTime = "lastUpdatedTime";
	/**
	 * 状态标志位，具体每种类型的取值不同，请参考基本参数定义文档或数据库。
	 */
	@Column (name="Status", nullable = false)
	protected Integer status;
	public static final String AttrStatus = "status";
	
	public Long getCreator() {
		return creator;
	}
	public void setCreator(Long creator) {
		this.creator = creator;
	}
	public Date getCreatedTime() {
		return createdTime;
	}
	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}
	public Long getLastUpdator() {
		return lastUpdator;
	}
	public void setLastUpdator(Long lastUpdator) {
		this.lastUpdator = lastUpdator;
	}
	public Date getLastUpdatedTime() {
		return lastUpdatedTime;
	}
	public void setLastUpdatedTime(Date lastUpdatedTime) {
		this.lastUpdatedTime = lastUpdatedTime;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer Status) {
		this.status = Status;
	}
	@Override
	public String toString() {
		return ObjectUtils.defaultToString(this);
	}
	@Override
	public String toJSONString() {
		return JsonUtils.toJsonObjectString(this);
	}
}
